import requests, time

username = "sirliu110@gmail.com"
password = "19880720"
hostname = "sirliu.ddns.net" # your domain name hosted in no-ip.com

s=requests.session()

url = 'http://members.3322.org/dyndns/getip' #花生壳IP地址

headers = 	{ #NO-IP请求头
			'Host': 'dynupdate.no-ip.com',
			'Authorization': 'Basic base64-encoded-auth-string',
			'User-Agent': 'Company NameOfProgram/OSVersion-ReleaseVersion maintainer-contact@example.com'
			}
old_ip = ''
while 1:
	try:
		r = s.get(url)
		if r.status_code == 200:
			current_ip = r.text
		else:
			continue

		if current_ip != old_ip:
			old_ip = current_ip
			try:
				print(current_ip)
				requests.get("http://{}:{}@dynupdate.no-ip.com/nic/update?hostname={}".format(*config),headers=headers)
			except:
				pass
	except:
		pass
	time.sleep(60)